<?php include("header.php"); ?>



<script type="text/javascript">

    function validate() {

        document.answer.submit();

    }



</script>



	<div class="one_center">

		<div class="box_two_third">

			<div class="box_head"><?php if (isset($answer)) { ?><?php if (!is_array($answer)) { if ($answer->id) { echo _LB_EDIT_ANSWER; } } else { echo _LB_ADD_ANSWER; } ?><?php } ?></div>

			<div class="box_content" >

				<form action="" name="answer" method="post">

				<input type="hidden" id="act" name="act" value="<?php echo ACT_VALID_EDIT; ?>"/>

                                <table cellpadding="0" cellspacing="5px" border="0">

                                    <tr>

                                            <td><?php echo _LB_QUESTION; ?>&nbsp;:&nbsp;<?php echo _LB_REQUIRE_FIELD; ?></td>

                                            <td>

                                                <?php if (is_array($answer)) { ?>

                                                <select id="question_id" name="question_id" >

                                                    <option><?php echo _LB_SELECT; ?></option>

                                                    <?php while ($question->fetchNext()) { ?>

                                                    <option value="<?php echo $question->id; ?>" <?php if ($question->id == $question_id) { ?>selected<?php } ?> ><?php echo $question->title; ?></option>

                                                    <?php } ?>

                                                </select>

                                                <?php } else { ?>

                                                <input type="hidden" name="question_id" value="<?php echo $question_id; ?>" />

                                                <?php while ($question->fetchNext()) { ?>

                                                <?php if ($question->id == $question_id) { echo $question->title; } ?>

                                                <?php } ?>

                                                <?php } ?>

                                            </td>

                                        </tr>

                                        

                                        <?php if (is_array($answer)) { ?>

                                

                                        <tr>

                                            <td width="20%"><?php echo _LB_ANSWER; ?>&nbsp;1&nbsp;:&nbsp;<?php echo _LB_REQUIRE_FIELD; ?></td>

                                            <td>

                                                <input type="hidden" id="id0" name="id0" value="<?php echo $answer[0]->id; ?>" />

                                                <input type="textbox" id="content0" name="content0" value="<?php echo $answer[0]->content; ?>" size="50" />

                                                <input type="radio" name="is_correct" id="is_correct0" <?php if ($answer[0]->is_correct) { ?>checked<?php } ?> value="0" />

                                            </td>

                                        </tr>

                                        

                                        <tr>

                                            <td width="20%"><?php echo _LB_ANSWER; ?>&nbsp;2&nbsp;:&nbsp;<?php echo _LB_REQUIRE_FIELD; ?></td>

                                            <td>

                                                <input type="hidden" id="id1" name="id1" value="<?php echo $answer[1]->id; ?>" />

                                                <input type="textbox" id="content1" name="content1" value="<?php echo $answer[1]->content; ?>" size="50" />

                                                <input type="radio" name="is_correct" id="is_correct1" <?php if ($answer[1]->is_correct) { ?>checked<?php } ?> value="1" />

                                            </td>

                                        </tr>

                                        

                                        <tr>

                                            <td width="20%"><?php echo _LB_ANSWER; ?>&nbsp;3&nbsp;:&nbsp;<?php echo _LB_REQUIRE_FIELD; ?></td>

                                            <td>

                                                <input type="hidden" id="id2" name="id2" value="<?php echo $answer[2]->id; ?>" />

                                                <input type="textbox" id="content2" name="content2" value="<?php echo $answer[2]->content; ?>" size="50" />

                                                <input type="radio" name="is_correct" id="is_correct2" <?php if ($answer[2]->is_correct) { ?>checked<?php } ?> value="2" />

                                            </td>

                                        </tr>

                                        

                                        <tr>

                                            <td width="20%"><?php echo _LB_ANSWER; ?>&nbsp;4&nbsp;:&nbsp;<?php echo _LB_REQUIRE_FIELD; ?></td>

                                            <td>

                                                <input type="hidden" id="id3" name="id3" value="<?php echo $answer[3]->id; ?>" />

                                                <input type="textbox" id="content3" name="content3" value="<?php echo $answer[3]->content; ?>" size="50" />

                                                <input type="radio" name="is_correct" id="is_correct3" <?php if ($answer[3]->is_correct) { ?>checked<?php } ?> value="3" />

                                            </td>

                                        </tr>

                                        

                                        <?php } else { ?>

                                        <?php if ($answer->id) { ?>

                                        <tr>

                                            <td width="20%"><?php echo _LB_ANSWER; ?>&nbsp;:&nbsp;<?php echo _LB_REQUIRE_FIELD; ?></td>

                                            <td>

                                                <input type="hidden" id="id" name="id" value="<?php echo $answer->id; ?>" />

                                                <input type="textbox" id="content" name="content" value="<?php echo $answer->content; ?>" size="50" />

                                            </td>

                                        </tr>

                                        <tr>

                                            <td width="20%"><?php echo _LB_IS_CORRECT; ?>&nbsp;:&nbsp;</td>

                                            <td><input type="checkbox" name="is_correct" id="is_correct" <?php if ($answer->is_correct) { ?>checked<?php } ?> value="1" /></td>

                                        </tr>

                                        <?php } ?>

                                        <?php } ?>

                                        

				

                                    <tr>

					  	<td class="submit" colspan="2" style="padding-top: 10px;">

							  <a id="auto_port_return" class="tribullet" id="btnReturn" href="<?php echo $backlink; ?>"><?php echo _LB_BACK; ?></a>

							  <a id="auto_port_validate" class="tribullet" href="#" onclick="validate()"><?php echo _LB_VALIDATE; ?></a>

						</td>

					</tr>

                                </table>

				</form>

			</div>

		</div>

	</div>



<?php include("footer.php"); ?>



